1. Field of the Invention
The present invention relates to an encoding technique of encoding image data.
2. Description of the Related Art
A conventional encoding technique separates an image into a foreground image such as a character portion containing binary data or limited colors and a portion (to be referred to as a background image hereinafter) such as a natural image except the foreground image, and applies different encoding methods to the respective parts.
For example, a character area of image data to be encoded is discriminated. Pixels in the character area are binarized to generate character image data. The character image data is encoded by MMR. On the other hand, the pixels (black pixels in general) of the character image are replaced with a pixel value in the ambient background image. This removes high-frequency components such as the character image. The image after replacement is encoded by JPEG. The MMR encoded data (the encoded data of the foreground image) and the JPEG encoded data (the encoded data of the background image) are integrated to output the encoding result of the original image.
In a decoding process, the encoded data of the background image is decoded. Then, only “character” portions of the character image obtained by decoding the encoded data of the foreground image (character image) are superimposed on the background image obtained by decoding.
The representative constituent element of the foreground image has been assumed to be a character. However, it need not always be a character. That is, an element including limited colors and having a sharp edge, such as a ruled line of a table, a line art, or a simple clipart can also be included in the foreground image.
The background image obtained by removing high-frequency components contains no high-frequency components literally or less high-frequency components. Human vision is insensible to high-frequency components. Even when the resolution of the background image is made slightly lower to remove the remaining high-frequency components, the degradation is not so noticeable and poses no problem. Hence, encoding is performed after decreasing both the horizontal and vertical resolutions of the background image to ½. As a result, the number of pixels of the image after resolution conversion is ¼ of that of the original image, and the encoded data can be generated at a high compression ratio. On the decoding side, after the encoded data of the background image is decoded, the resolution is converted to twice (twice in both the horizontal and vertical directions) using the interpolation technique. Then, the decoding result of the foreground image is superimposed on it. An example of a reference that discloses this technique is Japanese Patent Laid-Open No. 2002-77633.
The above-described technique of separating an original image into foreground and background images and encoding them requires a long time to analyze the structure of the document (to be referred to as a composite document hereinafter) containing both characters and a natural image and separate the foreground and background images. For example, the time required for the structure analysis and the separation process may exceed the time required for scanning one original page. In this case, the number of read original pages per unit time depends on the time required for the structure analysis and the separation process. That is, even when an image scanner capable of high-speed reading is prepared, it is impossible to make full use of the capabilities of the image scanner.
The following technique is supposed to solve this problem.
Image data read by an image scanner is simply encoded without the structure analysis and the separation process. The encoded data is stored in a storage device as intermediate encoded data. This process is repeated as long as original pages to be read remain. On the other hand, the intermediate encoded data stored in the storage device is decoded. The structure of image data obtained by decoding is analyzed, and the image data is separated into the foreground image and the background image. The images are re-encoded using different encoding techniques. This process is repeated.
However, the number of pixels of image data is increasing enormously along with an increase in the resolution of input and output devices. The above-described decoding and re-encoding processes apply heavy load on both hardware and software.
Additionally, when background image data having lower resolution is encoded, the image quality may degrade because of a determination error of the foreground and background images. For example, if some of lines or pixel points of one or some characters of a character string are determined as the background, and encoding is performed in this state, a large difference in the image quality is generated between the portion encoded as the foreground and that encoded as the background.